/*
 *
 *  * Copyright (c) iwindplus Technologies Co., Ltd.2024-2030, All rights reserved.
 *
 *
 */

package com.iwindplus.setup.server.api;

import com.iwindplus.boot.web.controller.BaseController;
import com.iwindplus.setup.api.MailboxApi;
import com.iwindplus.setup.server.service.MailboxService;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * 邮箱相关内部接口实现类.
 *
 * @author zengdegui
 * @since 2020/9/20
 */
@RestController
@RequestMapping
@Validated
@Slf4j
@RequiredArgsConstructor
public class MailboxApiImpl extends BaseController implements MailboxApi {

    private final MailboxService mailboxService;

    @Override
    public void send(String code, String subject, String content, List<String> tos, List<String> ccs, List<String> bccs,
        List<MultipartFile> attachments) {
        this.mailboxService.send(code, subject, content, tos, ccs, bccs, attachments);
    }

    @Override
    public void sendCaptcha(String tplCode, String mail) {
        this.mailboxService.sendCaptcha(tplCode, mail);
    }

    @Override
    public void sendCaptchaByUserId(String tplCode, Long userId, Long orgId) {
        this.mailboxService.sendCaptchaByUserId(tplCode, userId, orgId);
    }
}
